home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / windows / cm95_10.zip / INTERNET.DLL / TEXT / WILPEGASUS < prev    next >
Text File  |  1996-10-29  |  3KB  |  125 lines

  1. AddExtender ("WXSock32i.dll")
  2. IntControl (35, 500, 0, 0, 0)
  3. bOK = @TRUE
  4. sDial     = "<dialupname>"
  5. nMaxRedial = <numredials>
  6. nRedialDelay = 10
  7. sPgmPath  = "<pgmpath>"
  8. sPgmDir   = "<pgmdir>"
  9. bGetMail   = <getmail>
  10. bSendMail  = <sendmail>
  11. bGetSend   = <getsend>
  12. sErrDesc  = ""
  13. nWait      = 1 ; How many minutes to wait for Agent to finish its work
  14.  
  15.  
  16. ;Dial our host (unless user is on a direct connect)...
  17. hConn = 0
  18. nNumRedials = 0
  19. if ((bGetMail || bSendMail || bGetSend) && sDial <> "")
  20.     :DialIt
  21.     hConn = DUNConnect (sDial)
  22.     nErr = SGetLastErr ()
  23.     if (!hConn)
  24.         switch nErr
  25.         case @SErrNotFound
  26.             sErrDesc = "Couldn't connect to %sDial%: no such dial-up"
  27.             break
  28.         case @SErrBusy
  29.             if (nNumRedials <= nMaxRedial)
  30.                 nNumRedials = nNumRedials + 1
  31.                 Delay (nRedialDelay)
  32.                 goto DialIt
  33.             else
  34.                 sErrDesc = "Couldn't connect to %sDial%: Line busy"
  35.             endif
  36.             break
  37.         case @SErrNoAnswer
  38.             if (nNumRedials <= nMaxRedial)
  39.                 nNumRedials = nNumRedials + 1
  40.                 Delay (nRedialDelay)
  41.                 goto DialIt
  42.             else
  43.                 sErrDesc = "Couldn't connect to %sDial%: No answer"
  44.             endif
  45.             break
  46.         case @SErrVoice
  47.             sErrDesc = "Couldn't connect to %sDial%: A human answered"
  48.             break
  49.         case nErr ; <--default
  50.             sErrDesc = "Couldn't connect to %sDial% - error %nErr%"
  51.         endswitch
  52.         bOK = @FALSE
  53.         goto LogIt
  54.     else
  55.         if (nErr == @SAlready)
  56.             ; We're already connected. Don't hang up when this event is thru...
  57.             hConn = 0 
  58.         endif
  59.     endif
  60. endif
  61.  
  62.  
  63. ; Run Pegasus Mail & make it do things...
  64. sTitle = ""
  65. if (WinExist ("Pegasus Mail")) then sTitle = "Pegasus Mail"
  66. if (sTitle <> "")
  67.     WinActivate (sTitle)
  68. else
  69.     DirChange (sPgmDir)
  70.     Run (sPgmPath, "")
  71.     delay (6)
  72.     if (WinExist ("Pegasus Mail")) then sTitle = "Pegasus Mail"
  73. endif
  74.  
  75.  
  76. ; Check for new mail on server (if chosen)...
  77. if (bGetMail)
  78.     SendKeysTo (sTitle, "!fc")
  79.     Delay (10)
  80. endif
  81.  
  82. ; Send queued mail (if chosen)...
  83. if (bSendMail)
  84.     SendKeysTo (sTitle, "!fa")
  85.     Delay (10)
  86. endif
  87.  
  88. ; Get new mail and send mail (if chosen)...
  89. if (bGetSend)
  90.     SendKeysTo (sTitle, "!fh")
  91.     Delay (10)
  92. endif
  93.  
  94. ; Wait for nWait minutes, or till user kills off Pegasus Mail manually...
  95. for n=1 to nWait * 6
  96.     if (WinExist (sTitle))
  97.         Delay (10)
  98.         MouseMove (100+n, 100, "", "")
  99.     endif
  100. next n
  101.  
  102.  
  103. ; If user hit Ctrl+Break, WIL will bring us here...
  104. :Cancel
  105.  
  106. ; Hang up...
  107. :HangUp
  108. if (hConn)
  109.     nRet = DUNDisconnect (hConn)
  110. endif
  111.  
  112.  
  113. ; Log what we did...
  114. :LogIt
  115. if bOK == @TRUE
  116.     sLog = "Ran Pegasus Mail"
  117. else
  118.     sLog = strcat ("Error attempting to automate Pegasus Mail:", @CRLF, sErrDesc)
  119. endif
  120.  
  121. CMLogMessage (sLog)
  122. Display (8, "ClockMan95", sLog)
  123. exit
  124.  
  125.